package php.code.functions;

import php.code.indentation.Indentation;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* Created by thormentor on 08-04-2014.
*/
public class Array<T> extends Function {

    public Array(TextLayout textLayout, List<T> lines) {
        super(textLayout, lines
                .stream()
                .map(item -> item instanceof String ? "'" + item + "'" : item.toString())
                .collect(Collectors.toList()));
    }

    public Array(TextLayout textLayout, Map<?, String> map) {
        super(textLayout, map
                .entrySet()
                .stream()
                .map(entry -> Indentation.DEFAULT + wrap(entry.getKey()) + " => " + entry.getValue())
                .collect(Collectors.toList()));
    }

}
